{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "3D-photo-inpainting.ipynb",
      "provenance": [],
      "collapsed_sections": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "IY-s3ZpHBeAU",
        "colab_type": "text"
      },
      "source": [
        "## 3D Photo Inpainting - Turn Any Picture Into 3D Photo with Deep Learning and Python\n",
        "\n",
        "> TL;DR Learn how to create a 3D photo from a regular image using Machine Learning\n",
        "\n",
        "Have you seen those amazing 3D photos on Facebook and Instagram? How can you create your own from regular photos? We're going to do that with the help of a project called: [**3D Photography using Context-aware Layered Depth Inpainting**](https://shihmengli.github.io/3D-Photo-Inpainting/). We'll try out different photos, and have a look at how it all works!\n",
        "\n",
        "- [Read the tutorial](https://www.curiousily.com/posts/transfer-learning-for-image-classification-using-torchvision-pytorch-and-python/)\n",
        "- [Run the notebook in your browser (Google Colab)](https://colab.research.google.com/drive/10ECFY76fPco5DhMTKsj7ZZ6Hm_mI9K6g?usp=sharing)\n",
        "- [Read the `Getting Things Done with Pytorch` book](https://github.com/curiousily/Getting-Things-Done-with-Pytorch)\n",
        "\n",
        "Here's what we'll go over:\n",
        "\n",
        "- Install the prerequisites for the 3D photo inpainting project\n",
        "- Look at a demo\n",
        "- Convert some images into 3D photos\n",
        "- Dive deeper into how it works\n",
        "- Look into what training data was used\n",
        "\n",
        "Let's make some 3D photos!"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ForH8e46DqM0",
        "colab_type": "code",
        "outputId": "d8f762fd-fca6-4572-bbe1-fc5f81e272d6",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 306
        }
      },
      "source": [
        "!nvidia-smi"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Sat May 30 06:53:27 2020       \n",
            "+-----------------------------------------------------------------------------+\n",
            "| NVIDIA-SMI 440.82       Driver Version: 418.67       CUDA Version: 10.1     |\n",
            "|-------------------------------+----------------------+----------------------+\n",
            "| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n",
            "| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\n",
            "|===============================+======================+======================|\n",
            "|   0  Tesla P100-PCIE...  Off  | 00000000:00:04.0 Off |                    0 |\n",
            "| N/A   36C    P0    27W / 250W |      0MiB / 16280MiB |      0%      Default |\n",
            "+-------------------------------+----------------------+----------------------+\n",
            "                                                                               \n",
            "+-----------------------------------------------------------------------------+\n",
            "| Processes:                                                       GPU Memory |\n",
            "|  GPU       PID   Type   Process name                             Usage      |\n",
            "|=============================================================================|\n",
            "|  No running processes found                                                 |\n",
            "+-----------------------------------------------------------------------------+\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6URoA260_WZz",
        "colab_type": "text"
      },
      "source": [
        "## Prerequisites\n",
        "\n",
        "The 3D inpainting project requires some libraries preinstalled. Let's get those:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "5o-EIMeaghU0",
        "colab_type": "code",
        "outputId": "a1d44208-6651-4ecd-b48c-a23cde1b3646",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 238
        }
      },
      "source": [
        "!pip install -q vispy==0.6.4\n",
        "!pip install -q moviepy==1.0.2\n",
        "!pip install -q transforms3d==0.3.1\n",
        "!pip install -q networkx==2.3\n",
        "!pip install -q -U watermark"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "\u001b[K     |████████████████████████████████| 2.3MB 3.5MB/s \n",
            "\u001b[K     |████████████████████████████████| 890kB 30.8MB/s \n",
            "\u001b[K     |████████████████████████████████| 7.9MB 3.0MB/s \n",
            "\u001b[K     |████████████████████████████████| 3.3MB 34.0MB/s \n",
            "\u001b[K     |████████████████████████████████| 26.9MB 111kB/s \n",
            "\u001b[?25h  Building wheel for moviepy (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Building wheel for proglog (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "\u001b[31mERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible.\u001b[0m\n",
            "\u001b[K     |████████████████████████████████| 71kB 2.4MB/s \n",
            "\u001b[?25h  Building wheel for transforms3d (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "\u001b[K     |████████████████████████████████| 1.8MB 3.5MB/s \n",
            "\u001b[?25h  Building wheel for networkx (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "\u001b[31mERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible.\u001b[0m\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "uSy0I3tThrRj",
        "colab_type": "code",
        "outputId": "2c68e0ac-4d8a-4c75-af3d-1e7b068dadce",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 153
        }
      },
      "source": [
        "%reload_ext watermark\n",
        "%watermark -v -p torch,vispy,moviepy,transforms3d,networkx"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "CPython 3.6.9\n",
            "IPython 5.5.0\n",
            "\n",
            "torch 1.5.0+cu101\n",
            "vispy 0.6.4\n",
            "moviepy 0.2.3.5\n",
            "transforms3d 0.3.1\n",
            "networkx 2.4\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "hjDVEmTZa-TC",
        "colab_type": "text"
      },
      "source": [
        "We'll also define two helper functions that'll help us visualize depth estimations and final results:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "A-0txXuNOY-S",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from IPython.display import HTML\n",
        "from base64 import b64encode\n",
        "\n",
        "def show_inpainting(image_file, video_file):\n",
        "  image_content = open(image_file, 'rb').read()\n",
        "  video_content = open(video_file, 'rb').read()\n",
        "  image_data = \"data:image/jpg;base64,\" + b64encode(image_content).decode()\n",
        "  video_data = \"data:video/mp4;base64,\" + b64encode(video_content).decode()\n",
        "  html = HTML(f\"\"\"\n",
        "  <img height=756 src={image_data} />\n",
        "  <video height=756 controls loop>\n",
        "        <source src={video_data} type='video/mp4'>\n",
        "  </video>\n",
        "  \"\"\")\n",
        "  return html\n",
        "\n",
        "def show_depth_estimation(image_file, depth_file):\n",
        "  image_content = open(image_file, 'rb').read()\n",
        "  depth_content = open(depth_file, 'rb').read()\n",
        "  image_data = \"data:image/jpg;base64,\" + b64encode(image_content).decode()\n",
        "  depth_data = \"data:image/png;base64,\" + b64encode(depth_content).decode()\n",
        "  html = HTML(f\"\"\"\n",
        "  <img height=756 src={image_data} />\n",
        "  <img height=756 src={depth_data} />\n",
        "  \"\"\")\n",
        "  return html"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2kozu9jUA7q5",
        "colab_type": "text"
      },
      "source": [
        "The `show_inpainting()` function shows the inpainted video along with the original photo. `show_depth_estimation()` shows the estimated depth of each pixel of the image (more on that later)."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "KfCvQdHTz5bk",
        "colab_type": "text"
      },
      "source": [
        "## Demo\n",
        "\n",
        "Let's see what we're going to achieve:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Qr3MRME8maKR",
        "colab_type": "code",
        "outputId": "1c77eea8-f1a0-4801-bb81-1c4785c91b76",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "!mkdir demo\n",
        "!gdown -q --id 1VDT5YhANPJczevyhTdasJO5Zexl2l_fd -O demo/dog.jpg\n",
        "!gdown -q --id 1CAsRBub83ptC_zPWFRZIDQDU47tFy_ST -O demo/dog-inpainting.mp4\n",
        "\n",
        "show_inpainting('demo/dog.jpg', 'demo/dog-inpainting.mp4')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "qxFWJ_fQCrBE",
        "colab_type": "text"
      },
      "source": [
        "On the left, we have a photo of Ahil that I've taken with my phone. On the right is the result of the 3D inpainting that you're going to learn how to do."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "uu8huF3G3knj",
        "colab_type": "text"
      },
      "source": [
        "## Making 3D photos\n",
        "\n",
        "*Inpainting* refers to the process of recovering parts of images and videos that were lost or purposefully removed.\n",
        "\n",
        "The paper [3D Photography using Context-aware Layered Depth Inpainting](https://shihmengli.github.io/3D-Photo-Inpainting/) introduces a method to convert 2D photos into 3D using inpainting techniques.\n",
        "\n",
        "The full source code of the project is available on [GitHub](https://github.com/vt-vl-lab/3d-photo-inpainting). Let's clone the repo and download some pre-trained models:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cOFIBkWrBlNM",
        "colab_type": "code",
        "outputId": "194651c2-4c83-4fc8-ce79-7137ab6b71fd",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "%cd /content/\n",
        "!git clone https://github.com/vt-vl-lab/3d-photo-inpainting.git\n",
        "%cd 3d-photo-inpainting\n",
        "!git checkout e804c1cb2fd695be50946db2f1eb17134f6d1b38\n",
        "!sh download.sh"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content\n",
            "Cloning into '3d-photo-inpainting'...\n",
            "remote: Enumerating objects: 344, done.\u001b[K\n",
            "remote: Total 344 (delta 0), reused 0 (delta 0), pack-reused 344\u001b[K\n",
            "Receiving objects: 100% (344/344), 130.13 MiB | 32.12 MiB/s, done.\n",
            "Resolving deltas: 100% (189/189), done.\n",
            "/content/3d-photo-inpainting\n",
            "Note: checking out 'e804c1cb2fd695be50946db2f1eb17134f6d1b38'.\n",
            "\n",
            "You are in 'detached HEAD' state. You can look around, make experimental\n",
            "changes and commit them, and you can discard any commits you make in this\n",
            "state without impacting any branches by performing another checkout.\n",
            "\n",
            "If you want to create a new branch to retain commits you create, you may\n",
            "do so (now or later) by using -b with the checkout command again. Example:\n",
            "\n",
            "  git checkout -b <new-branch-name>\n",
            "\n",
            "HEAD is now at e804c1c Manually edited depth map.\n",
            "--2020-06-14 13:31:08--  https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/color-model.pth\n",
            "Resolving filebox.ece.vt.edu (filebox.ece.vt.edu)... 128.173.88.43\n",
            "Connecting to filebox.ece.vt.edu (filebox.ece.vt.edu)|128.173.88.43|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 206331633 (197M)\n",
            "Saving to: ‘color-model.pth’\n",
            "\n",
            "color-model.pth     100%[===================>] 196.77M  30.2MB/s    in 6.3s    \n",
            "\n",
            "2020-06-14 13:31:14 (31.0 MB/s) - ‘color-model.pth’ saved [206331633/206331633]\n",
            "\n",
            "--2020-06-14 13:31:14--  https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/depth-model.pth\n",
            "Resolving filebox.ece.vt.edu (filebox.ece.vt.edu)... 128.173.88.43\n",
            "Connecting to filebox.ece.vt.edu (filebox.ece.vt.edu)|128.173.88.43|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 206272258 (197M)\n",
            "Saving to: ‘depth-model.pth’\n",
            "\n",
            "depth-model.pth     100%[===================>] 196.72M  24.8MB/s    in 7.8s    \n",
            "\n",
            "2020-06-14 13:31:22 (25.2 MB/s) - ‘depth-model.pth’ saved [206272258/206272258]\n",
            "\n",
            "--2020-06-14 13:31:22--  https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth\n",
            "Resolving filebox.ece.vt.edu (filebox.ece.vt.edu)... 128.173.88.43\n",
            "Connecting to filebox.ece.vt.edu (filebox.ece.vt.edu)|128.173.88.43|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 45974122 (44M)\n",
            "Saving to: ‘edge-model.pth’\n",
            "\n",
            "edge-model.pth      100%[===================>]  43.84M  28.9MB/s    in 1.5s    \n",
            "\n",
            "2020-06-14 13:31:24 (28.9 MB/s) - ‘edge-model.pth’ saved [45974122/45974122]\n",
            "\n",
            "--2020-06-14 13:31:24--  https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/model.pt\n",
            "Resolving filebox.ece.vt.edu (filebox.ece.vt.edu)... 128.173.88.43\n",
            "Connecting to filebox.ece.vt.edu (filebox.ece.vt.edu)|128.173.88.43|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 149751722 (143M)\n",
            "Saving to: ‘model.pt’\n",
            "\n",
            "model.pt            100%[===================>] 142.81M  45.1MB/s    in 3.6s    \n",
            "\n",
            "2020-06-14 13:31:28 (39.5 MB/s) - ‘model.pt’ saved [149751722/149751722]\n",
            "\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZSuL4xAVLMZs",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "!rm depth/*\n",
        "!rm image/*\n",
        "!rm video/*"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Dad0tdFvBNOu",
        "colab_type": "text"
      },
      "source": [
        "Let's clear up the demo files, provided by the project, and download our own content:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "u8Y-mb-ijzDc",
        "colab_type": "code",
        "outputId": "8615de86-403e-456c-98f7-128e0aec30f6",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 221
        }
      },
      "source": [
        "!gdown --id 1b4MjYo_D5sps8F6JmYnomandLyQhjo6Z -O config.yml\n",
        "!gdown --id 1TYmKRP4387hjDMFfWaeqcOVY7do-m0LE -O image/castle.jpg\n",
        "!gdown --id 1VDT5YhANPJczevyhTdasJO5Zexl2l_fd -O image/dog.jpg"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Downloading...\n",
            "From: https://drive.google.com/uc?id=1b4MjYo_D5sps8F6JmYnomandLyQhjo6Z\n",
            "To: /content/3d-photo-inpainting/config.yml\n",
            "100% 1.22k/1.22k [00:00<00:00, 1.05MB/s]\n",
            "Downloading...\n",
            "From: https://drive.google.com/uc?id=1TYmKRP4387hjDMFfWaeqcOVY7do-m0LE\n",
            "To: /content/3d-photo-inpainting/image/castle.jpg\n",
            "2.36MB [00:00, 79.5MB/s]\n",
            "Downloading...\n",
            "From: https://drive.google.com/uc?id=1VDT5YhANPJczevyhTdasJO5Zexl2l_fd\n",
            "To: /content/3d-photo-inpainting/image/dog.jpg\n",
            "3.06MB [00:00, 94.9MB/s]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "XkP-QA6YCXR1",
        "colab_type": "text"
      },
      "source": [
        "The images you want to convert into 3D photos need to go into the `image` directory. For our example, I am adding 2 from my personal collection.\n",
        "\n",
        "We're going to use (mostly) the default config and make sure that offscreen rendering is disabled:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "BoBHtWLpB0tB",
        "colab_type": "code",
        "outputId": "27591f04-a3f2-4222-a4a0-5b3a174c6e1f",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 799
        }
      },
      "source": [
        "!cat config.yml"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "depth_edge_model_ckpt: checkpoints/edge-model.pth\n",
            "depth_feat_model_ckpt: checkpoints/depth-model.pth\n",
            "rgb_feat_model_ckpt: checkpoints/color-model.pth\n",
            "MiDaS_model_ckpt: MiDaS/model.pt\n",
            "fps: 40\n",
            "num_frames: 240\n",
            "x_shift_range: [0.00, 0.00, -0.02, -0.02]\n",
            "y_shift_range: [0.00, 0.00, -0.02, -0.00]\n",
            "z_shift_range: [-0.05, -0.05, -0.07, -0.07]\n",
            "traj_types: ['double-straight-line', 'double-straight-line', 'circle', 'circle']\n",
            "video_postfix: ['dolly-zoom-in', 'zoom-in', 'circle', 'swing']\n",
            "specific: ''\n",
            "longer_side_len: 960\n",
            "src_folder: image\n",
            "depth_folder: depth\n",
            "mesh_folder: mesh\n",
            "video_folder: video\n",
            "load_ply: False\n",
            "save_ply: True\n",
            "inference_video: True\n",
            "gpu_ids: 0\n",
            "offscreen_rendering: False\n",
            "img_format: '.jpg'\n",
            "depth_format: '.npy'\n",
            "require_midas: True\n",
            "depth_threshold: 0.04\n",
            "ext_edge_threshold: 0.002\n",
            "sparse_iter: 5\n",
            "filter_size: [7, 7, 5, 5, 5]\n",
            "sigma_s: 4.0\n",
            "sigma_r: 0.5\n",
            "redundant_number: 12\n",
            "background_thickness: 70\n",
            "context_thickness: 140\n",
            "background_thickness_2: 70\n",
            "context_thickness_2: 70\n",
            "discount_factor: 1.00\n",
            "log_depth: True\n",
            "largest_size: 512\n",
            "depth_edge_dilate: 10\n",
            "depth_edge_dilate_2: 5\n",
            "extrapolate_border: True\n",
            "extrapolation_thickness: 60\n",
            "repeat_inpaint_edge: True\n",
            "crop_border: [0.03, 0.03, 0.05, 0.03]\n",
            "anti_flickering: True\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Y_qJ5MZ0DDCB",
        "colab_type": "text"
      },
      "source": [
        "To start the inpainting process, we need to execute the `main.py` file and pass the config:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "i5-MWEjfBjYx",
        "colab_type": "code",
        "outputId": "b53b183a-398a-49a5-b4e6-31786b11bb25",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "!python main.py --config config.yml"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "running on device 0\n",
            "\r  0% 0/3 [00:00<?, ?it/s]Current Source ==>  moon\n",
            "Running depth extraction at 1590644508.3205004\n",
            "initialize\n",
            "device: cpu\n",
            "start processing\n",
            "  processing image/moon.jpg (1/1)\n",
            "torch.Size([1, 3, 384, 384])\n",
            "finished\n",
            "Start Running 3D_Photo ...\n",
            "Loading edge model at 1590644527.4762554\n",
            "Loading depth model at 1590644536.1686625\n",
            "Loading rgb model at 1590644537.0900998\n",
            "Writing depth ply (and basically doing everything) at 1590644537.987567\n",
            "Writing mesh file mesh/moon.ply ...\n",
            "Making video at 1590644725.6786122\n",
            "fov: 53.13010235415598\n",
            "Moviepy - Building video video/moon_dolly-zoom-in.mp4.\n",
            "Moviepy - Writing video video/moon_dolly-zoom-in.mp4\n",
            "\n",
            "  0% 0/3 [04:20<?, ?it/s]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   1% 2/241 [00:00<00:37,  6.34it/s, now=None]\u001b[A\n",
            "t:   1% 3/241 [00:00<00:34,  6.90it/s, now=None]\u001b[A\n",
            "t:   6% 14/241 [00:00<00:23,  9.59it/s, now=None]\u001b[A\n",
            "t:  10% 23/241 [00:00<00:16, 13.09it/s, now=None]\u001b[A\n",
            "t:  15% 35/241 [00:00<00:11, 17.83it/s, now=None]\u001b[A\n",
            "t:  18% 44/241 [00:00<00:08, 23.31it/s, now=None]\u001b[A\n",
            "t:  22% 52/241 [00:01<00:08, 21.84it/s, now=None]\u001b[A\n",
            "t:  24% 58/241 [00:01<00:08, 21.56it/s, now=None]\u001b[A\n",
            "t:  26% 63/241 [00:01<00:08, 20.34it/s, now=None]\u001b[A\n",
            "t:  28% 67/241 [00:02<00:08, 20.68it/s, now=None]\u001b[A\n",
            "t:  29% 71/241 [00:02<00:08, 20.59it/s, now=None]\u001b[A\n",
            "t:  31% 75/241 [00:02<00:08, 20.46it/s, now=None]\u001b[A\n",
            "t:  33% 79/241 [00:02<00:07, 20.71it/s, now=None]\u001b[A\n",
            "t:  34% 83/241 [00:02<00:07, 20.71it/s, now=None]\u001b[A\n",
            "t:  36% 87/241 [00:02<00:07, 20.49it/s, now=None]\u001b[A\n",
            "t:  38% 91/241 [00:03<00:07, 20.71it/s, now=None]\u001b[A\n",
            "t:  39% 94/241 [00:03<00:06, 21.70it/s, now=None]\u001b[A\n",
            "t:  40% 97/241 [00:03<00:06, 22.90it/s, now=None]\u001b[A\n",
            "t:  41% 100/241 [00:03<00:06, 20.42it/s, now=None]\u001b[A\n",
            "t:  43% 103/241 [00:03<00:06, 19.74it/s, now=None]\u001b[A\n",
            "t:  44% 106/241 [00:03<00:06, 21.03it/s, now=None]\u001b[A\n",
            "t:  45% 109/241 [00:04<00:06, 21.27it/s, now=None]\u001b[A\n",
            "t:  46% 112/241 [00:04<00:06, 20.39it/s, now=None]\u001b[A\n",
            "t:  48% 115/241 [00:04<00:06, 18.67it/s, now=None]\u001b[A\n",
            "t:  49% 118/241 [00:04<00:06, 20.28it/s, now=None]\u001b[A\n",
            "t:  50% 121/241 [00:04<00:05, 21.61it/s, now=None]\u001b[A\n",
            "t:  51% 124/241 [00:04<00:05, 20.28it/s, now=None]\u001b[A\n",
            "t:  53% 127/241 [00:04<00:05, 19.42it/s, now=None]\u001b[A\n",
            "t:  54% 131/241 [00:05<00:05, 19.59it/s, now=None]\u001b[A\n",
            "t:  56% 135/241 [00:05<00:05, 19.55it/s, now=None]\u001b[A\n",
            "t:  58% 139/241 [00:05<00:05, 19.87it/s, now=None]\u001b[A\n",
            "t:  59% 142/241 [00:05<00:04, 21.90it/s, now=None]\u001b[A\n",
            "t:  60% 145/241 [00:05<00:04, 22.57it/s, now=None]\u001b[A\n",
            "t:  61% 148/241 [00:05<00:04, 20.73it/s, now=None]\u001b[A\n",
            "t:  63% 151/241 [00:06<00:04, 19.28it/s, now=None]\u001b[A\n",
            "t:  64% 155/241 [00:06<00:04, 19.65it/s, now=None]\u001b[A\n",
            "t:  66% 158/241 [00:06<00:03, 21.40it/s, now=None]\u001b[A\n",
            "t:  67% 161/241 [00:06<00:03, 20.83it/s, now=None]\u001b[A\n",
            "t:  68% 164/241 [00:06<00:03, 20.17it/s, now=None]\u001b[A\n",
            "t:  69% 167/241 [00:06<00:03, 19.04it/s, now=None]\u001b[A\n",
            "t:  71% 171/241 [00:07<00:03, 19.26it/s, now=None]\u001b[A\n",
            "t:  72% 174/241 [00:07<00:03, 19.22it/s, now=None]\u001b[A\n",
            "t:  73% 177/241 [00:07<00:03, 20.52it/s, now=None]\u001b[A\n",
            "t:  75% 180/241 [00:07<00:02, 20.78it/s, now=None]\u001b[A\n",
            "t:  76% 183/241 [00:07<00:02, 19.58it/s, now=None]\u001b[A\n",
            "t:  77% 186/241 [00:07<00:02, 20.77it/s, now=None]\u001b[A\n",
            "t:  78% 189/241 [00:07<00:02, 22.09it/s, now=None]\u001b[A\n",
            "t:  80% 192/241 [00:08<00:02, 20.23it/s, now=None]\u001b[A\n",
            "t:  81% 195/241 [00:08<00:02, 19.12it/s, now=None]\u001b[A\n",
            "t:  82% 198/241 [00:08<00:02, 20.96it/s, now=None]\u001b[A\n",
            "t:  83% 201/241 [00:08<00:01, 21.18it/s, now=None]\u001b[A\n",
            "t:  85% 204/241 [00:08<00:01, 20.30it/s, now=None]\u001b[A\n",
            "t:  86% 207/241 [00:08<00:01, 18.00it/s, now=None]\u001b[A\n",
            "t:  87% 210/241 [00:09<00:01, 20.11it/s, now=None]\u001b[A\n",
            "t:  88% 213/241 [00:09<00:01, 20.61it/s, now=None]\u001b[A\n",
            "t:  90% 216/241 [00:09<00:01, 19.33it/s, now=None]\u001b[A\n",
            "t:  91% 219/241 [00:09<00:01, 18.59it/s, now=None]\u001b[A\n",
            "t:  93% 223/241 [00:09<00:00, 18.99it/s, now=None]\u001b[A\n",
            "t:  94% 227/241 [00:09<00:00, 19.41it/s, now=None]\u001b[A\n",
            "t:  95% 230/241 [00:10<00:00, 21.26it/s, now=None]\u001b[A\n",
            "t:  97% 233/241 [00:10<00:00, 20.62it/s, now=None]\u001b[A\n",
            "t:  98% 236/241 [00:10<00:00, 19.91it/s, now=None]\u001b[A\n",
            "t:  99% 239/241 [00:10<00:00, 18.34it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/moon_dolly-zoom-in.mp4\n",
            "Moviepy - Building video video/moon_zoom-in.mp4.\n",
            "Moviepy - Writing video video/moon_zoom-in.mp4\n",
            "\n",
            "  0% 0/3 [05:11<?, ?it/s]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   5% 11/241 [00:00<00:02, 102.82it/s, now=None]\u001b[A\n",
            "t:  10% 23/241 [00:00<00:02, 106.43it/s, now=None]\u001b[A\n",
            "t:  14% 33/241 [00:00<00:02, 103.49it/s, now=None]\u001b[A\n",
            "t:  18% 44/241 [00:00<00:01, 100.40it/s, now=None]\u001b[A\n",
            "t:  22% 52/241 [00:00<00:04, 42.54it/s, now=None] \u001b[A\n",
            "t:  24% 58/241 [00:01<00:06, 30.40it/s, now=None]\u001b[A\n",
            "t:  26% 63/241 [00:01<00:07, 23.56it/s, now=None]\u001b[A\n",
            "t:  28% 67/241 [00:01<00:07, 21.86it/s, now=None]\u001b[A\n",
            "t:  29% 71/241 [00:01<00:08, 20.34it/s, now=None]\u001b[A\n",
            "t:  31% 75/241 [00:02<00:08, 19.55it/s, now=None]\u001b[A\n",
            "t:  33% 79/241 [00:02<00:08, 19.33it/s, now=None]\u001b[A\n",
            "t:  34% 82/241 [00:02<00:07, 20.38it/s, now=None]\u001b[A\n",
            "t:  35% 85/241 [00:02<00:07, 20.42it/s, now=None]\u001b[A\n",
            "t:  37% 88/241 [00:02<00:08, 18.30it/s, now=None]\u001b[A\n",
            "t:  38% 91/241 [00:03<00:08, 17.41it/s, now=None]\u001b[A\n",
            "t:  39% 95/241 [00:03<00:08, 17.58it/s, now=None]\u001b[A\n",
            "t:  41% 98/241 [00:03<00:07, 19.91it/s, now=None]\u001b[A\n",
            "t:  42% 101/241 [00:03<00:07, 17.64it/s, now=None]\u001b[A\n",
            "t:  43% 103/241 [00:03<00:08, 17.07it/s, now=None]\u001b[A\n",
            "t:  44% 106/241 [00:03<00:07, 18.79it/s, now=None]\u001b[A\n",
            "t:  45% 109/241 [00:04<00:06, 19.12it/s, now=None]\u001b[A\n",
            "t:  46% 112/241 [00:04<00:07, 17.24it/s, now=None]\u001b[A\n",
            "t:  47% 114/241 [00:04<00:07, 17.58it/s, now=None]\u001b[A\n",
            "t:  48% 116/241 [00:04<00:06, 18.17it/s, now=None]\u001b[A\n",
            "t:  49% 119/241 [00:04<00:07, 17.35it/s, now=None]\u001b[A\n",
            "t:  51% 122/241 [00:04<00:06, 19.18it/s, now=None]\u001b[A\n",
            "t:  52% 125/241 [00:04<00:06, 19.17it/s, now=None]\u001b[A\n",
            "t:  53% 127/241 [00:05<00:07, 15.56it/s, now=None]\u001b[A\n",
            "t:  54% 130/241 [00:05<00:06, 17.56it/s, now=None]\u001b[A\n",
            "t:  55% 132/241 [00:05<00:06, 17.10it/s, now=None]\u001b[A\n",
            "t:  56% 135/241 [00:05<00:06, 16.47it/s, now=None]\u001b[A\n",
            "t:  57% 138/241 [00:05<00:05, 19.01it/s, now=None]\u001b[A\n",
            "t:  59% 141/241 [00:05<00:05, 18.63it/s, now=None]\u001b[A\n",
            "t:  60% 144/241 [00:06<00:05, 16.77it/s, now=None]\u001b[A\n",
            "t:  61% 147/241 [00:06<00:05, 16.19it/s, now=None]\u001b[A\n",
            "t:  62% 150/241 [00:06<00:05, 18.06it/s, now=None]\u001b[A\n",
            "t:  63% 152/241 [00:06<00:05, 17.28it/s, now=None]\u001b[A\n",
            "t:  64% 155/241 [00:06<00:05, 16.77it/s, now=None]\u001b[A\n",
            "t:  66% 159/241 [00:06<00:04, 17.18it/s, now=None]\u001b[A\n",
            "t:  67% 162/241 [00:06<00:04, 18.95it/s, now=None]\u001b[A\n",
            "t:  68% 164/241 [00:07<00:04, 17.30it/s, now=None]\u001b[A\n",
            "t:  69% 167/241 [00:07<00:04, 16.58it/s, now=None]\u001b[A\n",
            "t:  71% 170/241 [00:07<00:03, 18.25it/s, now=None]\u001b[A\n",
            "t:  71% 172/241 [00:07<00:03, 18.05it/s, now=None]\u001b[A\n",
            "t:  73% 175/241 [00:07<00:03, 17.28it/s, now=None]\u001b[A\n",
            "t:  74% 178/241 [00:07<00:03, 19.05it/s, now=None]\u001b[A\n",
            "t:  75% 181/241 [00:08<00:03, 18.80it/s, now=None]\u001b[A\n",
            "t:  76% 183/241 [00:08<00:03, 15.87it/s, now=None]\u001b[A\n",
            "t:  77% 186/241 [00:08<00:03, 17.51it/s, now=None]\u001b[A\n",
            "t:  78% 188/241 [00:08<00:03, 16.98it/s, now=None]\u001b[A\n",
            "t:  79% 190/241 [00:08<00:02, 17.65it/s, now=None]\u001b[A\n",
            "t:  80% 192/241 [00:08<00:02, 17.19it/s, now=None]\u001b[A\n",
            "t:  81% 195/241 [00:08<00:02, 16.74it/s, now=None]\u001b[A\n",
            "t:  82% 198/241 [00:09<00:02, 18.52it/s, now=None]\u001b[A\n",
            "t:  83% 200/241 [00:09<00:02, 16.38it/s, now=None]\u001b[A\n",
            "t:  84% 203/241 [00:09<00:02, 16.32it/s, now=None]\u001b[A\n",
            "t:  85% 206/241 [00:09<00:01, 18.00it/s, now=None]\u001b[A\n",
            "t:  86% 208/241 [00:09<00:02, 15.38it/s, now=None]\u001b[A\n",
            "t:  88% 211/241 [00:09<00:01, 15.58it/s, now=None]\u001b[A\n",
            "t:  89% 215/241 [00:10<00:01, 16.25it/s, now=None]\u001b[A\n",
            "t:  90% 218/241 [00:10<00:01, 18.26it/s, now=None]\u001b[A\n",
            "t:  91% 220/241 [00:10<00:01, 16.93it/s, now=None]\u001b[A\n",
            "t:  93% 223/241 [00:10<00:01, 16.44it/s, now=None]\u001b[A\n",
            "t:  94% 227/241 [00:10<00:00, 16.95it/s, now=None]\u001b[A\n",
            "t:  95% 230/241 [00:10<00:00, 18.02it/s, now=None]\u001b[A\n",
            "t:  96% 232/241 [00:10<00:00, 18.13it/s, now=None]\u001b[A\n",
            "t:  97% 234/241 [00:11<00:00, 18.12it/s, now=None]\u001b[A\n",
            "t:  98% 236/241 [00:11<00:00, 17.08it/s, now=None]\u001b[A\n",
            "t:  99% 239/241 [00:11<00:00, 16.72it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/moon_zoom-in.mp4\n",
            "Moviepy - Building video video/moon_circle.mp4.\n",
            "Moviepy - Writing video video/moon_circle.mp4\n",
            "\n",
            "  0% 0/3 [06:03<?, ?it/s]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   5% 13/241 [00:00<00:01, 124.80it/s, now=None]\u001b[A\n",
            "t:  10% 25/241 [00:00<00:01, 120.15it/s, now=None]\u001b[A\n",
            "t:  14% 34/241 [00:00<00:01, 109.16it/s, now=None]\u001b[A\n",
            "t:  19% 45/241 [00:00<00:01, 106.70it/s, now=None]\u001b[A\n",
            "t:  22% 53/241 [00:01<00:05, 34.33it/s, now=None] \u001b[A\n",
            "t:  24% 59/241 [00:01<00:07, 25.94it/s, now=None]\u001b[A\n",
            "t:  27% 64/241 [00:01<00:07, 23.22it/s, now=None]\u001b[A\n",
            "t:  28% 68/241 [00:01<00:08, 21.39it/s, now=None]\u001b[A\n",
            "t:  30% 72/241 [00:02<00:08, 19.63it/s, now=None]\u001b[A\n",
            "t:  31% 75/241 [00:02<00:08, 18.64it/s, now=None]\u001b[A\n",
            "t:  32% 78/241 [00:02<00:08, 18.20it/s, now=None]\u001b[A\n",
            "t:  34% 81/241 [00:02<00:09, 16.93it/s, now=None]\u001b[A\n",
            "t:  34% 83/241 [00:02<00:08, 17.75it/s, now=None]\u001b[A\n",
            "t:  35% 85/241 [00:02<00:08, 17.76it/s, now=None]\u001b[A\n",
            "t:  36% 87/241 [00:03<00:09, 15.41it/s, now=None]\u001b[A\n",
            "t:  37% 90/241 [00:03<00:08, 16.92it/s, now=None]\u001b[A\n",
            "t:  38% 92/241 [00:03<00:09, 15.61it/s, now=None]\u001b[A\n",
            "t:  39% 94/241 [00:03<00:08, 16.65it/s, now=None]\u001b[A\n",
            "t:  40% 96/241 [00:03<00:09, 14.78it/s, now=None]\u001b[A\n",
            "t:  41% 99/241 [00:03<00:09, 14.95it/s, now=None]\u001b[A\n",
            "t:  42% 102/241 [00:03<00:08, 16.35it/s, now=None]\u001b[A\n",
            "t:  43% 104/241 [00:04<00:09, 15.03it/s, now=None]\u001b[A\n",
            "t:  44% 107/241 [00:04<00:08, 15.09it/s, now=None]\u001b[A\n",
            "t:  46% 110/241 [00:04<00:07, 17.52it/s, now=None]\u001b[A\n",
            "t:  46% 112/241 [00:04<00:08, 14.44it/s, now=None]\u001b[A\n",
            "t:  47% 114/241 [00:04<00:08, 15.64it/s, now=None]\u001b[A\n",
            "t:  48% 116/241 [00:04<00:08, 15.26it/s, now=None]\u001b[A\n",
            "t:  49% 118/241 [00:04<00:07, 16.11it/s, now=None]\u001b[A\n",
            "t:  50% 120/241 [00:05<00:07, 15.30it/s, now=None]\u001b[A\n",
            "t:  51% 123/241 [00:05<00:07, 15.08it/s, now=None]\u001b[A\n",
            "t:  52% 126/241 [00:05<00:06, 16.56it/s, now=None]\u001b[A\n",
            "t:  53% 128/241 [00:05<00:07, 14.96it/s, now=None]\u001b[A\n",
            "t:  54% 131/241 [00:05<00:07, 14.91it/s, now=None]\u001b[A\n",
            "t:  56% 134/241 [00:05<00:06, 15.82it/s, now=None]\u001b[A\n",
            "t:  56% 136/241 [00:06<00:06, 15.97it/s, now=None]\u001b[A\n",
            "t:  57% 138/241 [00:06<00:06, 16.22it/s, now=None]\u001b[A\n",
            "t:  58% 140/241 [00:06<00:06, 16.26it/s, now=None]\u001b[A\n",
            "t:  59% 143/241 [00:06<00:06, 15.36it/s, now=None]\u001b[A\n",
            "t:  61% 146/241 [00:06<00:05, 16.71it/s, now=None]\u001b[A\n",
            "t:  61% 148/241 [00:06<00:05, 16.69it/s, now=None]\u001b[A\n",
            "t:  62% 150/241 [00:06<00:05, 16.38it/s, now=None]\u001b[A\n",
            "t:  63% 152/241 [00:07<00:05, 17.05it/s, now=None]\u001b[A\n",
            "t:  64% 154/241 [00:07<00:05, 16.69it/s, now=None]\u001b[A\n",
            "t:  65% 156/241 [00:07<00:04, 17.37it/s, now=None]\u001b[A\n",
            "t:  66% 158/241 [00:07<00:04, 17.72it/s, now=None]\u001b[A\n",
            "t:  66% 160/241 [00:07<00:04, 16.97it/s, now=None]\u001b[A\n",
            "t:  67% 162/241 [00:07<00:05, 15.72it/s, now=None]\u001b[A\n",
            "t:  68% 165/241 [00:07<00:04, 18.16it/s, now=None]\u001b[A\n",
            "t:  69% 167/241 [00:07<00:04, 15.19it/s, now=None]\u001b[A\n",
            "t:  71% 171/241 [00:08<00:04, 15.63it/s, now=None]\u001b[A\n",
            "t:  72% 174/241 [00:08<00:03, 18.00it/s, now=None]\u001b[A\n",
            "t:  73% 177/241 [00:08<00:03, 17.77it/s, now=None]\u001b[A\n",
            "t:  74% 179/241 [00:08<00:04, 14.46it/s, now=None]\u001b[A\n",
            "t:  76% 182/241 [00:08<00:03, 15.74it/s, now=None]\u001b[A\n",
            "t:  76% 184/241 [00:08<00:03, 15.62it/s, now=None]\u001b[A\n",
            "t:  77% 186/241 [00:09<00:03, 15.08it/s, now=None]\u001b[A\n",
            "t:  78% 188/241 [00:09<00:03, 16.01it/s, now=None]\u001b[A\n",
            "t:  79% 191/241 [00:09<00:03, 14.76it/s, now=None]\u001b[A\n",
            "t:  80% 194/241 [00:09<00:02, 16.46it/s, now=None]\u001b[A\n",
            "t:  81% 196/241 [00:09<00:02, 15.18it/s, now=None]\u001b[A\n",
            "t:  83% 199/241 [00:09<00:02, 15.11it/s, now=None]\u001b[A\n",
            "t:  84% 202/241 [00:10<00:02, 15.92it/s, now=None]\u001b[A\n",
            "t:  85% 204/241 [00:10<00:02, 16.31it/s, now=None]\u001b[A\n",
            "t:  86% 207/241 [00:10<00:02, 15.67it/s, now=None]\u001b[A\n",
            "t:  87% 210/241 [00:10<00:01, 18.14it/s, now=None]\u001b[A\n",
            "t:  88% 212/241 [00:10<00:01, 14.98it/s, now=None]\u001b[A\n",
            "t:  89% 215/241 [00:10<00:01, 14.84it/s, now=None]\u001b[A\n",
            "t:  90% 218/241 [00:11<00:01, 16.74it/s, now=None]\u001b[A\n",
            "t:  91% 220/241 [00:11<00:01, 15.94it/s, now=None]\u001b[A\n",
            "t:  92% 222/241 [00:11<00:01, 16.12it/s, now=None]\u001b[A\n",
            "t:  93% 224/241 [00:11<00:01, 15.54it/s, now=None]\u001b[A\n",
            "t:  94% 227/241 [00:11<00:00, 14.70it/s, now=None]\u001b[A\n",
            "t:  96% 231/241 [00:11<00:00, 15.47it/s, now=None]\u001b[A\n",
            "t:  97% 234/241 [00:12<00:00, 16.86it/s, now=None]\u001b[A\n",
            "t:  98% 236/241 [00:12<00:00, 16.47it/s, now=None]\u001b[A\n",
            "t:  99% 239/241 [00:12<00:00, 15.83it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/moon_circle.mp4\n",
            "Moviepy - Building video video/moon_swing.mp4.\n",
            "Moviepy - Writing video video/moon_swing.mp4\n",
            "\n",
            "  0% 0/3 [06:57<?, ?it/s]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   3% 8/241 [00:00<00:02, 79.37it/s, now=None]\u001b[A\n",
            "t:   7% 18/241 [00:00<00:02, 82.42it/s, now=None]\u001b[A\n",
            "t:  12% 29/241 [00:00<00:02, 88.67it/s, now=None]\u001b[A\n",
            "t:  17% 40/241 [00:00<00:02, 92.24it/s, now=None]\u001b[A\n",
            "t:  20% 48/241 [00:00<00:03, 48.90it/s, now=None]\u001b[A\n",
            "t:  22% 54/241 [00:01<00:05, 32.02it/s, now=None]\u001b[A\n",
            "t:  24% 59/241 [00:01<00:07, 24.99it/s, now=None]\u001b[A\n",
            "t:  26% 63/241 [00:01<00:06, 26.08it/s, now=None]\u001b[A\n",
            "t:  28% 67/241 [00:01<00:08, 20.23it/s, now=None]\u001b[A\n",
            "t:  29% 70/241 [00:02<00:08, 19.91it/s, now=None]\u001b[A\n",
            "t:  30% 73/241 [00:02<00:09, 18.06it/s, now=None]\u001b[A\n",
            "t:  32% 76/241 [00:02<00:09, 17.38it/s, now=None]\u001b[A\n",
            "t:  33% 79/241 [00:02<00:08, 19.64it/s, now=None]\u001b[A\n",
            "t:  34% 82/241 [00:02<00:08, 18.49it/s, now=None]\u001b[A\n",
            "t:  35% 85/241 [00:02<00:09, 16.87it/s, now=None]\u001b[A\n",
            "t:  36% 87/241 [00:03<00:09, 16.65it/s, now=None]\u001b[A\n",
            "t:  37% 89/241 [00:03<00:09, 16.17it/s, now=None]\u001b[A\n",
            "t:  38% 92/241 [00:03<00:09, 15.72it/s, now=None]\u001b[A\n",
            "t:  39% 94/241 [00:03<00:09, 15.99it/s, now=None]\u001b[A\n",
            "t:  40% 97/241 [00:03<00:08, 16.61it/s, now=None]\u001b[A\n",
            "t:  41% 100/241 [00:03<00:08, 16.26it/s, now=None]\u001b[A\n",
            "t:  43% 103/241 [00:03<00:07, 18.27it/s, now=None]\u001b[A\n",
            "t:  44% 105/241 [00:04<00:08, 15.45it/s, now=None]\u001b[A\n",
            "t:  45% 108/241 [00:04<00:08, 15.09it/s, now=None]\u001b[A\n",
            "t:  46% 110/241 [00:04<00:08, 15.67it/s, now=None]\u001b[A\n",
            "t:  46% 112/241 [00:04<00:08, 15.41it/s, now=None]\u001b[A\n",
            "t:  48% 115/241 [00:04<00:08, 15.22it/s, now=None]\u001b[A\n",
            "t:  49% 118/241 [00:04<00:07, 16.35it/s, now=None]\u001b[A\n",
            "t:  50% 120/241 [00:05<00:08, 15.02it/s, now=None]\u001b[A\n",
            "t:  51% 123/241 [00:05<00:06, 17.45it/s, now=None]\u001b[A\n",
            "t:  52% 125/241 [00:05<00:07, 15.25it/s, now=None]\u001b[A\n",
            "t:  53% 128/241 [00:05<00:07, 15.02it/s, now=None]\u001b[A\n",
            "t:  54% 131/241 [00:05<00:06, 17.24it/s, now=None]\u001b[A\n",
            "t:  55% 133/241 [00:05<00:07, 15.01it/s, now=None]\u001b[A\n",
            "t:  56% 135/241 [00:05<00:06, 15.43it/s, now=None]\u001b[A\n",
            "t:  57% 137/241 [00:06<00:06, 14.93it/s, now=None]\u001b[A\n",
            "t:  58% 140/241 [00:06<00:06, 15.06it/s, now=None]\u001b[A\n",
            "t:  59% 143/241 [00:06<00:06, 15.76it/s, now=None]\u001b[A\n",
            "t:  61% 146/241 [00:06<00:05, 17.05it/s, now=None]\u001b[A\n",
            "t:  61% 148/241 [00:06<00:06, 15.31it/s, now=None]\u001b[A\n",
            "t:  63% 151/241 [00:06<00:05, 16.18it/s, now=None]\u001b[A\n",
            "t:  63% 153/241 [00:07<00:05, 15.91it/s, now=None]\u001b[A\n",
            "t:  64% 155/241 [00:07<00:05, 16.41it/s, now=None]\u001b[A\n",
            "t:  65% 157/241 [00:07<00:05, 16.03it/s, now=None]\u001b[A\n",
            "t:  66% 160/241 [00:07<00:04, 16.58it/s, now=None]\u001b[A\n",
            "t:  67% 162/241 [00:07<00:05, 15.03it/s, now=None]\u001b[A\n",
            "t:  68% 165/241 [00:07<00:04, 16.23it/s, now=None]\u001b[A\n",
            "t:  70% 168/241 [00:07<00:04, 17.26it/s, now=None]\u001b[A\n",
            "t:  71% 171/241 [00:08<00:03, 18.37it/s, now=None]\u001b[A\n",
            "t:  73% 175/241 [00:08<00:03, 19.54it/s, now=None]\u001b[A\n",
            "t:  74% 178/241 [00:08<00:03, 20.52it/s, now=None]\u001b[A\n",
            "t:  75% 181/241 [00:08<00:03, 18.63it/s, now=None]\u001b[A\n",
            "t:  76% 183/241 [00:08<00:03, 17.12it/s, now=None]\u001b[A\n",
            "t:  77% 185/241 [00:08<00:03, 16.88it/s, now=None]\u001b[A\n",
            "t:  78% 188/241 [00:09<00:03, 16.57it/s, now=None]\u001b[A\n",
            "t:  79% 191/241 [00:09<00:02, 17.45it/s, now=None]\u001b[A\n",
            "t:  80% 193/241 [00:09<00:02, 16.37it/s, now=None]\u001b[A\n",
            "t:  81% 196/241 [00:09<00:02, 15.53it/s, now=None]\u001b[A\n",
            "t:  83% 199/241 [00:09<00:02, 17.43it/s, now=None]\u001b[A\n",
            "t:  83% 201/241 [00:09<00:02, 16.14it/s, now=None]\u001b[A\n",
            "t:  84% 203/241 [00:09<00:02, 16.46it/s, now=None]\u001b[A\n",
            "t:  85% 205/241 [00:10<00:02, 15.50it/s, now=None]\u001b[A\n",
            "t:  86% 207/241 [00:10<00:02, 15.33it/s, now=None]\u001b[A\n",
            "t:  87% 209/241 [00:10<00:02, 15.30it/s, now=None]\u001b[A\n",
            "t:  88% 212/241 [00:10<00:01, 15.36it/s, now=None]\u001b[A\n",
            "t:  89% 215/241 [00:10<00:01, 17.96it/s, now=None]\u001b[A\n",
            "t:  90% 217/241 [00:10<00:01, 15.02it/s, now=None]\u001b[A\n",
            "t:  91% 220/241 [00:11<00:01, 14.66it/s, now=None]\u001b[A\n",
            "t:  93% 223/241 [00:11<00:01, 17.13it/s, now=None]\u001b[A\n",
            "t:  93% 225/241 [00:11<00:01, 14.68it/s, now=None]\u001b[A\n",
            "t:  94% 227/241 [00:11<00:00, 14.51it/s, now=None]\u001b[A\n",
            "t:  95% 230/241 [00:11<00:00, 15.66it/s, now=None]\u001b[A\n",
            "t:  96% 232/241 [00:11<00:00, 14.83it/s, now=None]\u001b[A\n",
            "t:  98% 236/241 [00:12<00:00, 15.21it/s, now=None]\u001b[A\n",
            "t:  99% 239/241 [00:12<00:00, 17.07it/s, now=None]\u001b[A\n",
            "t: 100% 241/241 [00:12<00:00, 15.41it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/moon_swing.mp4\n",
            " 33% 1/3 [07:11<14:23, 431.91s/it]Current Source ==>  castle\n",
            "Running depth extraction at 1590644940.4247215\n",
            "initialize\n",
            "device: cpu\n",
            "start processing\n",
            "  processing image/castle.jpg (1/1)\n",
            "torch.Size([1, 3, 384, 288])\n",
            "finished\n",
            "Start Running 3D_Photo ...\n",
            "Loading edge model at 1590644960.082962\n",
            "Loading depth model at 1590644961.5847917\n",
            "Loading rgb model at 1590644968.0181339\n",
            "Writing depth ply (and basically doing everything) at 1590644975.213863\n",
            "Writing mesh file mesh/castle.ply ...\n",
            "Making video at 1590645159.2128425\n",
            "fov: 53.13010235415598\n",
            "Moviepy - Building video video/castle_dolly-zoom-in.mp4.\n",
            "Moviepy - Writing video video/castle_dolly-zoom-in.mp4\n",
            "\n",
            " 33% 1/3 [11:28<14:23, 431.91s/it]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   7% 17/241 [00:00<00:01, 163.72it/s, now=None]\u001b[A\n",
            "t:  15% 35/241 [00:00<00:01, 167.08it/s, now=None]\u001b[A\n",
            "t:  20% 48/241 [00:00<00:01, 114.64it/s, now=None]\u001b[A\n",
            "t:  24% 57/241 [00:00<00:03, 60.13it/s, now=None] \u001b[A\n",
            "t:  27% 64/241 [00:00<00:03, 46.81it/s, now=None]\u001b[A\n",
            "t:  29% 70/241 [00:01<00:04, 38.09it/s, now=None]\u001b[A\n",
            "t:  31% 75/241 [00:01<00:04, 34.72it/s, now=None]\u001b[A\n",
            "t:  33% 80/241 [00:01<00:04, 33.21it/s, now=None]\u001b[A\n",
            "t:  35% 84/241 [00:01<00:04, 31.87it/s, now=None]\u001b[A\n",
            "t:  37% 88/241 [00:01<00:04, 31.29it/s, now=None]\u001b[A\n",
            "t:  38% 92/241 [00:01<00:04, 30.80it/s, now=None]\u001b[A\n",
            "t:  40% 96/241 [00:02<00:05, 28.63it/s, now=None]\u001b[A\n",
            "t:  41% 100/241 [00:02<00:04, 28.78it/s, now=None]\u001b[A\n",
            "t:  43% 103/241 [00:02<00:05, 26.76it/s, now=None]\u001b[A\n",
            "t:  44% 106/241 [00:02<00:04, 27.49it/s, now=None]\u001b[A\n",
            "t:  45% 109/241 [00:02<00:04, 26.82it/s, now=None]\u001b[A\n",
            "t:  47% 113/241 [00:02<00:04, 28.96it/s, now=None]\u001b[A\n",
            "t:  48% 116/241 [00:02<00:04, 28.61it/s, now=None]\u001b[A\n",
            "t:  49% 119/241 [00:02<00:04, 28.71it/s, now=None]\u001b[A\n",
            "t:  51% 123/241 [00:03<00:04, 27.53it/s, now=None]\u001b[A\n",
            "t:  53% 127/241 [00:03<00:04, 27.55it/s, now=None]\u001b[A\n",
            "t:  54% 131/241 [00:03<00:04, 27.41it/s, now=None]\u001b[A\n",
            "t:  56% 135/241 [00:03<00:03, 27.68it/s, now=None]\u001b[A\n",
            "t:  58% 139/241 [00:03<00:03, 27.37it/s, now=None]\u001b[A\n",
            "t:  59% 143/241 [00:03<00:03, 27.59it/s, now=None]\u001b[A\n",
            "t:  61% 147/241 [00:03<00:03, 27.75it/s, now=None]\u001b[A\n",
            "t:  63% 151/241 [00:04<00:03, 27.02it/s, now=None]\u001b[A\n",
            "t:  64% 155/241 [00:04<00:03, 27.39it/s, now=None]\u001b[A\n",
            "t:  66% 159/241 [00:04<00:02, 27.48it/s, now=None]\u001b[A\n",
            "t:  68% 163/241 [00:04<00:02, 27.00it/s, now=None]\u001b[A\n",
            "t:  69% 167/241 [00:04<00:02, 27.16it/s, now=None]\u001b[A\n",
            "t:  71% 171/241 [00:04<00:02, 27.62it/s, now=None]\u001b[A\n",
            "t:  73% 175/241 [00:04<00:02, 27.05it/s, now=None]\u001b[A\n",
            "t:  74% 179/241 [00:05<00:02, 26.49it/s, now=None]\u001b[A\n",
            "t:  76% 183/241 [00:05<00:02, 27.05it/s, now=None]\u001b[A\n",
            "t:  78% 187/241 [00:05<00:02, 25.95it/s, now=None]\u001b[A\n",
            "t:  79% 190/241 [00:05<00:01, 26.63it/s, now=None]\u001b[A\n",
            "t:  80% 193/241 [00:05<00:01, 27.33it/s, now=None]\u001b[A\n",
            "t:  81% 196/241 [00:05<00:01, 26.17it/s, now=None]\u001b[A\n",
            "t:  83% 199/241 [00:05<00:01, 25.82it/s, now=None]\u001b[A\n",
            "t:  84% 203/241 [00:06<00:01, 26.11it/s, now=None]\u001b[A\n",
            "t:  85% 206/241 [00:06<00:01, 27.10it/s, now=None]\u001b[A\n",
            "t:  87% 209/241 [00:06<00:01, 26.57it/s, now=None]\u001b[A\n",
            "t:  88% 212/241 [00:06<00:01, 26.82it/s, now=None]\u001b[A\n",
            "t:  89% 215/241 [00:06<00:01, 25.80it/s, now=None]\u001b[A\n",
            "t:  91% 219/241 [00:06<00:00, 26.54it/s, now=None]\u001b[A\n",
            "t:  93% 223/241 [00:06<00:00, 26.87it/s, now=None]\u001b[A\n",
            "t:  94% 227/241 [00:06<00:00, 26.86it/s, now=None]\u001b[A\n",
            "t:  96% 231/241 [00:07<00:00, 25.42it/s, now=None]\u001b[A\n",
            "t:  98% 235/241 [00:07<00:00, 25.22it/s, now=None]\u001b[A\n",
            "t:  99% 238/241 [00:07<00:00, 25.67it/s, now=None]\u001b[A\n",
            "t: 100% 241/241 [00:07<00:00, 25.74it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/castle_dolly-zoom-in.mp4\n",
            "Moviepy - Building video video/castle_zoom-in.mp4.\n",
            "Moviepy - Writing video video/castle_zoom-in.mp4\n",
            "\n",
            " 33% 1/3 [12:14<14:23, 431.91s/it]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   7% 17/241 [00:00<00:01, 163.60it/s, now=None]\u001b[A\n",
            "t:  15% 35/241 [00:00<00:01, 167.72it/s, now=None]\u001b[A\n",
            "t:  20% 48/241 [00:00<00:01, 100.55it/s, now=None]\u001b[A\n",
            "t:  23% 56/241 [00:00<00:03, 55.40it/s, now=None] \u001b[A\n",
            "t:  26% 63/241 [00:01<00:04, 40.24it/s, now=None]\u001b[A\n",
            "t:  29% 69/241 [00:01<00:05, 34.22it/s, now=None]\u001b[A\n",
            "t:  31% 74/241 [00:01<00:05, 30.47it/s, now=None]\u001b[A\n",
            "t:  32% 78/241 [00:01<00:05, 29.97it/s, now=None]\u001b[A\n",
            "t:  34% 82/241 [00:01<00:05, 28.69it/s, now=None]\u001b[A\n",
            "t:  36% 86/241 [00:01<00:05, 27.94it/s, now=None]\u001b[A\n",
            "t:  37% 90/241 [00:02<00:05, 25.40it/s, now=None]\u001b[A\n",
            "t:  39% 93/241 [00:02<00:06, 23.84it/s, now=None]\u001b[A\n",
            "t:  40% 96/241 [00:02<00:06, 23.80it/s, now=None]\u001b[A\n",
            "t:  41% 99/241 [00:02<00:06, 23.55it/s, now=None]\u001b[A\n",
            "t:  43% 103/241 [00:02<00:05, 24.17it/s, now=None]\u001b[A\n",
            "t:  44% 106/241 [00:02<00:05, 23.81it/s, now=None]\u001b[A\n",
            "t:  45% 109/241 [00:02<00:05, 25.08it/s, now=None]\u001b[A\n",
            "t:  46% 112/241 [00:03<00:05, 24.86it/s, now=None]\u001b[A\n",
            "t:  48% 115/241 [00:03<00:05, 23.86it/s, now=None]\u001b[A\n",
            "t:  49% 119/241 [00:03<00:05, 23.50it/s, now=None]\u001b[A\n",
            "t:  51% 123/241 [00:03<00:04, 24.38it/s, now=None]\u001b[A\n",
            "t:  53% 127/241 [00:03<00:04, 24.60it/s, now=None]\u001b[A\n",
            "t:  54% 130/241 [00:03<00:04, 25.74it/s, now=None]\u001b[A\n",
            "t:  55% 133/241 [00:03<00:04, 25.91it/s, now=None]\u001b[A\n",
            "t:  56% 136/241 [00:04<00:04, 24.22it/s, now=None]\u001b[A\n",
            "t:  58% 139/241 [00:04<00:04, 23.76it/s, now=None]\u001b[A\n",
            "t:  59% 143/241 [00:04<00:04, 23.41it/s, now=None]\u001b[A\n",
            "t:  61% 146/241 [00:04<00:03, 24.71it/s, now=None]\u001b[A\n",
            "t:  62% 149/241 [00:04<00:03, 24.54it/s, now=None]\u001b[A\n",
            "t:  63% 152/241 [00:04<00:03, 24.30it/s, now=None]\u001b[A\n",
            "t:  64% 155/241 [00:04<00:03, 23.84it/s, now=None]\u001b[A\n",
            "t:  66% 158/241 [00:04<00:03, 25.18it/s, now=None]\u001b[A\n",
            "t:  67% 161/241 [00:05<00:03, 22.81it/s, now=None]\u001b[A\n",
            "t:  68% 165/241 [00:05<00:03, 24.17it/s, now=None]\u001b[A\n",
            "t:  70% 168/241 [00:05<00:03, 23.61it/s, now=None]\u001b[A\n",
            "t:  71% 171/241 [00:05<00:03, 23.12it/s, now=None]\u001b[A\n",
            "t:  73% 175/241 [00:05<00:02, 23.02it/s, now=None]\u001b[A\n",
            "t:  74% 179/241 [00:05<00:02, 23.23it/s, now=None]\u001b[A\n",
            "t:  76% 182/241 [00:05<00:02, 24.83it/s, now=None]\u001b[A\n",
            "t:  77% 185/241 [00:06<00:02, 23.92it/s, now=None]\u001b[A\n",
            "t:  78% 188/241 [00:06<00:02, 24.02it/s, now=None]\u001b[A\n",
            "t:  79% 191/241 [00:06<00:02, 23.71it/s, now=None]\u001b[A\n",
            "t:  81% 195/241 [00:06<00:01, 23.23it/s, now=None]\u001b[A\n",
            "t:  83% 199/241 [00:06<00:01, 23.66it/s, now=None]\u001b[A\n",
            "t:  84% 203/241 [00:06<00:01, 23.71it/s, now=None]\u001b[A\n",
            "t:  86% 207/241 [00:06<00:01, 24.04it/s, now=None]\u001b[A\n",
            "t:  88% 211/241 [00:07<00:01, 24.21it/s, now=None]\u001b[A\n",
            "t:  89% 215/241 [00:07<00:01, 24.53it/s, now=None]\u001b[A\n",
            "t:  90% 218/241 [00:07<00:00, 25.29it/s, now=None]\u001b[A\n",
            "t:  92% 221/241 [00:07<00:00, 25.57it/s, now=None]\u001b[A\n",
            "t:  93% 224/241 [00:07<00:00, 24.03it/s, now=None]\u001b[A\n",
            "t:  94% 227/241 [00:07<00:00, 23.27it/s, now=None]\u001b[A\n",
            "t:  95% 230/241 [00:07<00:00, 24.94it/s, now=None]\u001b[A\n",
            "t:  97% 233/241 [00:08<00:00, 24.81it/s, now=None]\u001b[A\n",
            "t:  98% 236/241 [00:08<00:00, 23.21it/s, now=None]\u001b[A\n",
            "t:  99% 239/241 [00:08<00:00, 23.42it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/castle_zoom-in.mp4\n",
            "Moviepy - Building video video/castle_circle.mp4.\n",
            "Moviepy - Writing video video/castle_circle.mp4\n",
            "\n",
            " 33% 1/3 [13:01<14:23, 431.91s/it]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   7% 17/241 [00:00<00:01, 162.22it/s, now=None]\u001b[A\n",
            "t:  15% 36/241 [00:00<00:01, 167.20it/s, now=None]\u001b[A\n",
            "t:  20% 48/241 [00:00<00:02, 89.81it/s, now=None] \u001b[A\n",
            "t:  23% 56/241 [00:00<00:03, 51.34it/s, now=None]\u001b[A\n",
            "t:  26% 62/241 [00:01<00:04, 40.40it/s, now=None]\u001b[A\n",
            "t:  28% 68/241 [00:01<00:05, 32.61it/s, now=None]\u001b[A\n",
            "t:  30% 73/241 [00:01<00:05, 31.15it/s, now=None]\u001b[A\n",
            "t:  32% 77/241 [00:01<00:05, 28.57it/s, now=None]\u001b[A\n",
            "t:  34% 81/241 [00:01<00:06, 26.32it/s, now=None]\u001b[A\n",
            "t:  35% 85/241 [00:01<00:06, 24.93it/s, now=None]\u001b[A\n",
            "t:  37% 88/241 [00:02<00:06, 23.80it/s, now=None]\u001b[A\n",
            "t:  38% 91/241 [00:02<00:06, 23.01it/s, now=None]\u001b[A\n",
            "t:  39% 94/241 [00:02<00:06, 24.46it/s, now=None]\u001b[A\n",
            "t:  40% 97/241 [00:02<00:05, 24.43it/s, now=None]\u001b[A\n",
            "t:  41% 100/241 [00:02<00:06, 21.85it/s, now=None]\u001b[A\n",
            "t:  43% 103/241 [00:02<00:06, 21.63it/s, now=None]\u001b[A\n",
            "t:  44% 107/241 [00:02<00:06, 21.87it/s, now=None]\u001b[A\n",
            "t:  46% 110/241 [00:03<00:05, 23.73it/s, now=None]\u001b[A\n",
            "t:  47% 113/241 [00:03<00:06, 21.16it/s, now=None]\u001b[A\n",
            "t:  48% 116/241 [00:03<00:05, 22.38it/s, now=None]\u001b[A\n",
            "t:  49% 119/241 [00:03<00:05, 22.01it/s, now=None]\u001b[A\n",
            "t:  51% 123/241 [00:03<00:05, 21.96it/s, now=None]\u001b[A\n",
            "t:  53% 127/241 [00:03<00:05, 22.07it/s, now=None]\u001b[A\n",
            "t:  54% 131/241 [00:04<00:04, 22.36it/s, now=None]\u001b[A\n",
            "t:  56% 134/241 [00:04<00:04, 22.98it/s, now=None]\u001b[A\n",
            "t:  57% 137/241 [00:04<00:04, 22.76it/s, now=None]\u001b[A\n",
            "t:  58% 140/241 [00:04<00:04, 23.68it/s, now=None]\u001b[A\n",
            "t:  59% 143/241 [00:04<00:04, 23.51it/s, now=None]\u001b[A\n",
            "t:  61% 146/241 [00:04<00:04, 23.72it/s, now=None]\u001b[A\n",
            "t:  62% 149/241 [00:04<00:03, 23.06it/s, now=None]\u001b[A\n",
            "t:  63% 152/241 [00:04<00:03, 22.30it/s, now=None]\u001b[A\n",
            "t:  64% 155/241 [00:05<00:03, 22.78it/s, now=None]\u001b[A\n",
            "t:  66% 158/241 [00:05<00:03, 23.89it/s, now=None]\u001b[A\n",
            "t:  67% 161/241 [00:05<00:03, 22.91it/s, now=None]\u001b[A\n",
            "t:  68% 164/241 [00:05<00:03, 23.08it/s, now=None]\u001b[A\n",
            "t:  69% 167/241 [00:05<00:03, 23.90it/s, now=None]\u001b[A\n",
            "t:  71% 170/241 [00:05<00:02, 25.22it/s, now=None]\u001b[A\n",
            "t:  72% 173/241 [00:05<00:02, 23.32it/s, now=None]\u001b[A\n",
            "t:  73% 176/241 [00:05<00:02, 23.30it/s, now=None]\u001b[A\n",
            "t:  74% 179/241 [00:06<00:02, 23.75it/s, now=None]\u001b[A\n",
            "t:  76% 183/241 [00:06<00:02, 23.56it/s, now=None]\u001b[A\n",
            "t:  78% 187/241 [00:06<00:02, 23.56it/s, now=None]\u001b[A\n",
            "t:  79% 190/241 [00:06<00:02, 24.45it/s, now=None]\u001b[A\n",
            "t:  80% 193/241 [00:06<00:02, 23.20it/s, now=None]\u001b[A\n",
            "t:  81% 196/241 [00:06<00:01, 23.60it/s, now=None]\u001b[A\n",
            "t:  83% 199/241 [00:06<00:01, 22.50it/s, now=None]\u001b[A\n",
            "t:  84% 203/241 [00:07<00:01, 22.88it/s, now=None]\u001b[A\n",
            "t:  86% 207/241 [00:07<00:01, 22.63it/s, now=None]\u001b[A\n",
            "t:  87% 210/241 [00:07<00:01, 22.83it/s, now=None]\u001b[A\n",
            "t:  89% 214/241 [00:07<00:01, 25.17it/s, now=None]\u001b[A\n",
            "t:  90% 217/241 [00:07<00:01, 22.62it/s, now=None]\u001b[A\n",
            "t:  91% 220/241 [00:07<00:00, 21.74it/s, now=None]\u001b[A\n",
            "t:  93% 223/241 [00:08<00:00, 21.32it/s, now=None]\u001b[A\n",
            "t:  94% 226/241 [00:08<00:00, 21.71it/s, now=None]\u001b[A\n",
            "t:  95% 229/241 [00:08<00:00, 22.38it/s, now=None]\u001b[A\n",
            "t:  96% 232/241 [00:08<00:00, 22.97it/s, now=None]\u001b[A\n",
            "t:  98% 235/241 [00:08<00:00, 22.09it/s, now=None]\u001b[A\n",
            "t:  99% 239/241 [00:08<00:00, 21.96it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/castle_circle.mp4\n",
            "Moviepy - Building video video/castle_swing.mp4.\n",
            "Moviepy - Writing video video/castle_swing.mp4\n",
            "\n",
            " 33% 1/3 [13:48<14:23, 431.91s/it]\n",
            "t:   0% 0/241 [00:00<?, ?it/s, now=None]\u001b[A\n",
            "t:   6% 14/241 [00:00<00:01, 139.01it/s, now=None]\u001b[A\n",
            "t:  12% 28/241 [00:00<00:01, 138.98it/s, now=None]\u001b[A\n",
            "t:  18% 44/241 [00:00<00:01, 138.64it/s, now=None]\u001b[A\n",
            "t:  22% 54/241 [00:00<00:03, 52.06it/s, now=None] \u001b[A\n",
            "t:  26% 62/241 [00:01<00:04, 40.87it/s, now=None]\u001b[A\n",
            "t:  28% 68/241 [00:01<00:05, 32.80it/s, now=None]\u001b[A\n",
            "t:  30% 73/241 [00:01<00:05, 29.35it/s, now=None]\u001b[A\n",
            "t:  32% 77/241 [00:01<00:06, 26.74it/s, now=None]\u001b[A\n",
            "t:  34% 81/241 [00:01<00:06, 26.20it/s, now=None]\u001b[A\n",
            "t:  35% 85/241 [00:02<00:06, 25.25it/s, now=None]\u001b[A\n",
            "t:  37% 88/241 [00:02<00:06, 22.64it/s, now=None]\u001b[A\n",
            "t:  38% 92/241 [00:02<00:06, 22.83it/s, now=None]\u001b[A\n",
            "t:  40% 96/241 [00:02<00:06, 22.14it/s, now=None]\u001b[A\n",
            "t:  41% 100/241 [00:02<00:06, 22.46it/s, now=None]\u001b[A\n",
            "t:  43% 104/241 [00:02<00:06, 22.77it/s, now=None]\u001b[A\n",
            "t:  45% 108/241 [00:03<00:05, 22.83it/s, now=None]\u001b[A\n",
            "t:  46% 111/241 [00:03<00:05, 22.30it/s, now=None]\u001b[A\n",
            "t:  48% 115/241 [00:03<00:05, 23.59it/s, now=None]\u001b[A\n",
            "t:  49% 118/241 [00:03<00:05, 23.35it/s, now=None]\u001b[A\n",
            "t:  50% 121/241 [00:03<00:05, 21.49it/s, now=None]\u001b[A\n",
            "t:  51% 124/241 [00:03<00:05, 21.65it/s, now=None]\u001b[A\n",
            "t:  53% 128/241 [00:04<00:05, 22.19it/s, now=None]\u001b[A\n",
            "t:  55% 132/241 [00:04<00:04, 22.40it/s, now=None]\u001b[A\n",
            "t:  56% 135/241 [00:04<00:04, 24.09it/s, now=None]\u001b[A\n",
            "t:  57% 138/241 [00:04<00:04, 23.44it/s, now=None]\u001b[A\n",
            "t:  59% 141/241 [00:04<00:04, 22.63it/s, now=None]\u001b[A\n",
            "t:  60% 144/241 [00:04<00:04, 21.41it/s, now=None]\u001b[A\n",
            "t:  61% 147/241 [00:04<00:04, 22.45it/s, now=None]\u001b[A\n",
            "t:  62% 150/241 [00:04<00:03, 23.67it/s, now=None]\u001b[A\n",
            "t:  63% 153/241 [00:05<00:03, 22.00it/s, now=None]\u001b[A\n",
            "t:  65% 156/241 [00:05<00:03, 22.85it/s, now=None]\u001b[A\n",
            "t:  66% 159/241 [00:05<00:03, 23.67it/s, now=None]\u001b[A\n",
            "t:  67% 162/241 [00:05<00:03, 23.21it/s, now=None]\u001b[A\n",
            "t:  69% 166/241 [00:05<00:03, 22.87it/s, now=None]\u001b[A\n",
            "t:  71% 170/241 [00:05<00:02, 25.64it/s, now=None]\u001b[A\n",
            "t:  72% 173/241 [00:05<00:02, 25.82it/s, now=None]\u001b[A\n",
            "t:  73% 176/241 [00:06<00:02, 25.20it/s, now=None]\u001b[A\n",
            "t:  74% 179/241 [00:06<00:02, 26.23it/s, now=None]\u001b[A\n",
            "t:  76% 182/241 [00:06<00:02, 25.34it/s, now=None]\u001b[A\n",
            "t:  77% 185/241 [00:06<00:02, 23.46it/s, now=None]\u001b[A\n",
            "t:  78% 188/241 [00:06<00:02, 23.33it/s, now=None]\u001b[A\n",
            "t:  79% 191/241 [00:06<00:02, 22.49it/s, now=None]\u001b[A\n",
            "t:  80% 194/241 [00:06<00:01, 24.01it/s, now=None]\u001b[A\n",
            "t:  82% 197/241 [00:06<00:01, 22.47it/s, now=None]\u001b[A\n",
            "t:  83% 200/241 [00:07<00:01, 21.93it/s, now=None]\u001b[A\n",
            "t:  85% 204/241 [00:07<00:01, 22.12it/s, now=None]\u001b[A\n",
            "t:  86% 208/241 [00:07<00:01, 22.34it/s, now=None]\u001b[A\n",
            "t:  88% 212/241 [00:07<00:01, 21.19it/s, now=None]\u001b[A\n",
            "t:  90% 216/241 [00:07<00:01, 21.84it/s, now=None]\u001b[A\n",
            "t:  91% 220/241 [00:07<00:00, 21.97it/s, now=None]\u001b[A\n",
            "t:  93% 223/241 [00:08<00:00, 23.42it/s, now=None]\u001b[A\n",
            "t:  94% 226/241 [00:08<00:00, 21.91it/s, now=None]\u001b[A\n",
            "t:  95% 229/241 [00:08<00:00, 23.67it/s, now=None]\u001b[A\n",
            "t:  96% 232/241 [00:08<00:00, 23.67it/s, now=None]\u001b[A\n",
            "t:  98% 235/241 [00:08<00:00, 22.82it/s, now=None]\u001b[A\n",
            "t:  99% 238/241 [00:08<00:00, 22.25it/s, now=None]\u001b[A\n",
            "t: 100% 241/241 [00:08<00:00, 21.81it/s, now=None]\u001b[A\n",
            "Moviepy - Done !\n",
            "Moviepy - video ready video/castle_swing.mp4\n",
            " 67% 2/3 [13:59<07:04, 424.61s/it]Current Source ==>  dog\n",
            "Running depth extraction at 1590645348.0083952\n",
            "initialize\n",
            "device: cpu\n",
            "start processing\n",
            "  processing image/dog.jpg (1/1)\n",
            "torch.Size([1, 3, 384, 288])\n",
            "finished\n",
            "Start Running 3D_Photo ...\n",
            "Loading edge model at 1590645366.8289177\n",
            "Loading depth model at 1590645368.3264463\n",
            "Loading rgb model at 1590645373.6664896\n",
            "Writing depth ply (and basically doing everything) at 1590645379.9804468\n",
            "Writing mesh file mesh/dog.ply ...\n",
            "Making video at 1590645567.9994094\n",
            "fov: 53.13010235415598\n",
            "Traceback (most recent call last):\n",
            "  File \"main.py\", line 137, in <module>\n",
            "    mean_loc_depth=mean_loc_depth)\n",
            "  File \"/content/3d-photo-inpainting/mesh.py\", line 2249, in output_3d_photo\n",
            "    img = cv2.GaussianBlur(img,(int(init_factor//2 * 2 + 1), int(init_factor//2 * 2 + 1)), 0)\n",
            "KeyboardInterrupt\n",
            " 67% 2/3 [18:12<09:06, 546.22s/it]\n",
            "^C\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "y0qFNHXZDQJx",
        "colab_type": "text"
      },
      "source": [
        "This might take some time, depending on the GPU that you have."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "gtx3mIYb3obL",
        "colab_type": "text"
      },
      "source": [
        "### Estimated depth\n",
        "\n",
        "I've promised you that we're going to look at the estimated depth later. The time has come, let's look at some depth estimations:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "BbmOpNlq3_9q",
        "colab_type": "code",
        "outputId": "4d87b005-1b41-4f33-b8e9-4ab2636b97d6",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 776
        }
      },
      "source": [
        "show_depth_estimation('image/dog.jpg', 'depth/dog.png')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "trp5p8O_4QfT",
        "colab_type": "code",
        "outputId": "c8cd378f-1c86-4f4d-8f02-cd515ac660ec",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 776
        }
      },
      "source": [
        "show_depth_estimation('image/castle.jpg', 'depth/castle.png')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "FsxKar2IDq8V",
        "colab_type": "text"
      },
      "source": [
        "Lighter pixels represent shorter distance, relative to the camera. I would say that it's doing a great job!"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "QWQCaEuj3nMb",
        "colab_type": "text"
      },
      "source": [
        "### Results\n",
        "\n",
        "Here are the 3D inpainting of the two images:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "L91aSquIQ9mT",
        "colab_type": "code",
        "outputId": "f8c745ff-b523-4c85-a027-894da7aaf91c",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "show_inpainting('image/dog.jpg', 'video/dog_swing.mp4')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "aQkOiQo71ix-",
        "colab_type": "code",
        "outputId": "1d88b5f6-4314-4fad-a5cf-34511bff7eda",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "show_inpainting('image/castle.jpg', 'video/castle_circle.mp4')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "QYBOpGJjF-pK",
        "colab_type": "text"
      },
      "source": [
        "Amazing, right?"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ySjcUwcX0NXg",
        "colab_type": "text"
      },
      "source": [
        "## How does it work?\n",
        "\n",
        "Here is a high level overview:\n",
        "\n",
        "- Get the depth of each pixel (how far back is from the camera)\n",
        " - RGB-D image from a dual-camera device (phone)\n",
        " \n",
        " or\n",
        "\n",
        " - Depth estimation with MiDaS: https://github.com/intel-isl/MiDaS\n",
        "- Create LDI (layered depth image) representation\n",
        "- Detect regions with a high depth difference (context/synthesis regions)\n",
        "- Cut out those regions (this roughly resembles cutting out objects from the image)\n",
        "- Generate the background behind the cut off objects\n",
        "- Merge the background and cut out objects into a new LDI\n",
        "\n",
        "The process is a lot more involved (including heavy image preprocessing), but you need to read the paper/code to get into the details."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "e5ykM9VB48TB",
        "colab_type": "text"
      },
      "source": [
        "## What was the training data?\n",
        "\n",
        "The authors didn't create a special dataset for their task. They generate data.\n",
        "\n",
        "First, the depth of images from the [MSCOCO dataset](http://cocodataset.org/) is estimated using a pre-trained [MegaDepth model](https://research.cs.cornell.edu/megadepth/). Then context/synthesis regions are extracted. A random sample of regions is merged with a set of images from the MSCOCO dataset. Thus, you get the ground truth of the backgrounds."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GJzpbYgLH2pv",
        "colab_type": "text"
      },
      "source": [
        "## Conclusion\n",
        "\n",
        "You can now convert any image into a 3D photo! Pretty amazing, right?\n",
        "\n",
        "- [Read the tutorial](https://www.curiousily.com/posts/transfer-learning-for-image-classification-using-torchvision-pytorch-and-python/)\n",
        "- [Run the notebook in your browser (Google Colab)](https://colab.research.google.com/drive/10ECFY76fPco5DhMTKsj7ZZ6Hm_mI9K6g?usp=sharing)\n",
        "- [Read the `Getting Things Done with Pytorch` book](https://github.com/curiousily/Getting-Things-Done-with-Pytorch)\n",
        "\n",
        "Here's what you've went over:\n",
        "\n",
        "- Install the prerequisites for the 3D photo inpainting project\n",
        "- Look at a demo\n",
        "- Convert some images into 3D photos\n",
        "- Dive deeper into how it works\n",
        "- Look into what training data was used\n",
        "\n",
        "Go on, try it on your own photos and show me the results in the comments!"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9zuoMryb4_7Q",
        "colab_type": "text"
      },
      "source": [
        "## References\n",
        "\n",
        "- [3D Photo Inpainting project webpage](https://shihmengli.github.io/3D-Photo-Inpainting/)\n",
        "- [3D Photography using Context-aware Layered Depth Inpainting](https://arxiv.org/abs/2004.04727)\n",
        "- [Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer](https://arxiv.org/pdf/1907.01341v2.pdf)\n"
      ]
    }
  ]
}